﻿<%@ WebHandler Language="C#" Class="News_UpdateStatus" %>

using System;
using System.Web;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

public class News_UpdateStatus : IHttpHandler
{
    TblTinTucManager _TblTinTucManager = new TblTinTucManager();
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/html";
        string check = "";
        int NewsID = 0;
        try{NewsID = Convert.ToInt32(context.Request.QueryString["id"].Trim());}
        catch{NewsID = 0;}

        if (NewsID != 0)
        {

            TblTinTucEntity _TblTinTucEntity = _TblTinTucManager.SelectOne(NewsID);
            _TblTinTucEntity.TrangThai = !_TblTinTucEntity.TrangThai;
            check = _TblTinTucEntity.TrangThai.ToString();

            try { _TblTinTucManager.Update(_TblTinTucEntity).ToString(); check = _TblTinTucEntity.TrangThai.ToString().ToLower(); }
            catch { }
        }
        context.Response.Write(check);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}